function validatePassword(password){
    if(!password){
        return -1;
    } else if(password.length < 8){
        return -2;
    }
    return 1;
}

function validatePassword2(password, password2){
    if(!password2){
        return -1;
    } else if(password !== password2){
        return -2;
    }
    return 1;
}

function validateEmail(email){
    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(!email){
        return -1;
    } else if(!regex.test(email)){
        return -2;
    }
    return 1;
}

function validateUsername(username){
    if(!username){
        return -1;
    } else if(username.length < 6){
        return -2;
    }
    return 1;
}